<?php

/**
 * This is the model class for table "setting".
 *
 * The followings are the available columns in table 'setting':
 * @property string $setting_id
 * @property string $positions
 * @property double $positions_value
 * @property string $positions_currency
 * @property string $positions_expire_day
 * @property double $positions_outcome
 * @property string $positions_outcome_unit
 * @property string $create_date
 * @property string $create_by
 * @property string $update_date
 * @property string $update_by
 * @property string $status
 * @property string $site_name
 * @property string $site_url
 * @property string $started_on
 * @property string $site_email
 */
class Setting extends CActiveRecord {

    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return Setting the static model class
     */
    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'setting';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('positions_value, positions_outcome', 'numerical'),
            array('positions, positions_expire_day, create_by, update_by', 'length', 'max' => 10),
            array('positions_currency, positions_outcome_unit, status', 'length', 'max' => 45),
            array('site_name, site_url, site_email', 'length', 'max' => 255),
            array('create_date, update_date, started_on', 'safe'),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('setting_id, positions, positions_value, positions_currency, positions_expire_day, positions_outcome, positions_outcome_unit, create_date, create_by, update_date, update_by, status, site_name, site_url, started_on, site_email', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'setting_id' => 'Setting',
            'positions' => 'Positions',
            'positions_value' => 'Positions Value',
            'positions_currency' => 'Positions Currency',
            'positions_expire_day' => 'Positions Expire Day',
            'positions_outcome' => 'Positions Outcome',
            'positions_outcome_unit' => 'Positions Outcome Unit',
            'create_date' => 'Create Date',
            'create_by' => 'Create By',
            'update_date' => 'Update Date',
            'update_by' => 'Update By',
            'status' => 'Status',
            'site_name' => 'Site Name',
            'site_url' => 'Site Url',
            'started_on' => 'Started On',
            'site_email' => 'Site Email',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search() {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria = new CDbCriteria;

        $criteria->compare('setting_id', $this->setting_id, true);
        $criteria->compare('positions', $this->positions, true);
        $criteria->compare('positions_value', $this->positions_value);
        $criteria->compare('positions_currency', $this->positions_currency, true);
        $criteria->compare('positions_expire_day', $this->positions_expire_day, true);
        $criteria->compare('positions_outcome', $this->positions_outcome);
        $criteria->compare('positions_outcome_unit', $this->positions_outcome_unit, true);
        $criteria->compare('create_date', $this->create_date, true);
        $criteria->compare('create_by', $this->create_by, true);
        $criteria->compare('update_date', $this->update_date, true);
        $criteria->compare('update_by', $this->update_by, true);
        $criteria->compare('status', $this->status, true);
        $criteria->compare('site_name', $this->site_name, true);
        $criteria->compare('site_url', $this->site_url, true);
        $criteria->compare('started_on', $this->started_on, true);
        $criteria->compare('site_email', $this->site_email, true);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
        ));
    }

}